package com.seda.fdc.ejb.reports.pdfgenerator.lowagie.text.image;

import java.io.IOException;
import java.net.MalformedURLException;

import com.lowagie.text.BadElementException;
import com.lowagie.text.Document;
import com.lowagie.text.Utilities;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfWriter; 

public class SimpleImageBox extends AbstractImageBox { 
	
	public SimpleImageBox( ){
		super(); 
	} 

	 

	public SimpleImageBox(double millimitersX, double millimitersY){  
		super( Utilities.millimetersToPoints((float) millimitersX), 
				Utilities.millimetersToPoints((float) millimitersY) );
	}
	 
	public void setAbsolutePosition(float millimitersX, float millimitersY, PdfWriter writer) throws IllegalStateException, BadElementException, MalformedURLException, IOException{  
		super.setAbsolutePosition(Utilities.millimetersToPoints(millimitersX), 
				Utilities.millimetersToPoints(millimitersY), writer);  
	}


	public void setAbsolutePosition(double millimitersX, double millimitersY, PdfContentByte pdfContentByte) throws IllegalStateException, BadElementException, MalformedURLException, IOException{
		this.setAbsolutePosition((float)millimitersX, (float)millimitersY, pdfContentByte);
	}
	
	
	public void setAbsolutePosition(float millimitersX, float millimitersY, PdfContentByte pdfContentByte) throws IllegalStateException, BadElementException, MalformedURLException, IOException{ 
		super.setAbsolutePosition(Utilities.millimetersToPoints(millimitersX), 
				Utilities.millimetersToPoints(millimitersY), pdfContentByte);  
	}
 

	public void setAbsolutePositionTop(double millimitersX, double millimitersY, PdfContentByte pdfContentByte, float pageHeightMillimiters) throws IllegalStateException, BadElementException, MalformedURLException, IOException{
		this.setAbsolutePositionTop((float)millimitersX, (float)millimitersY, pdfContentByte, pageHeightMillimiters);
	}
	
	public void setAbsolutePositionTop(float millimitersX, float millimitersY, PdfContentByte pdfContentByte, float pageHeightMillimiters) throws IllegalStateException, BadElementException, MalformedURLException, IOException{
		super.setAbsolutePosition(Utilities.millimetersToPoints(millimitersX), 
				Utilities.millimetersToPoints(pageHeightMillimiters -  millimitersY), pdfContentByte);  
	}
	
	public void setAbsolutePositionTop(float millimitersX, float millimitersY, PdfWriter writer, Document doc) throws IllegalStateException, BadElementException, MalformedURLException, IOException{
		float heightPageInMillimiters =  Utilities.pointsToMillimeters(doc.getPageSize().getHeight() ); 
		setAbsolutePosition(millimitersX, heightPageInMillimiters - millimitersY, writer);  
	}
	
	

}
